package com.example.mybatisplusstudy.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;


@AllArgsConstructor
@NoArgsConstructor
@Data
public class User {

    private static final long serialVersionId = 1L;

    private String userName;

    private String password;

    private String phone;

    private String email;

    private Integer age;

    private String role;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date createTime; // sqlite 不支持该类型 会自动专为 long 类型

    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    @TableLogic(value = "0",delval = "1")
    private Integer deleted;

    @Version
    private String version;

    public User(String userName, String password, String phone, String email, Integer age, String role) {
        this.userName = userName;
        this.password = password;
        this.phone = phone;
        this.email = email;
        this.age = age;
        this.role = role;
    }
}